Skip to content

docker: prefix the containerd snapshotter rootfs path with /rootfs - #3975

Closed
jannes-m wants to merge 1 commit into
google:masterfrom
jannes-m:docker-snapshotter-rootfs-prefix
Closed

jannes-m wants to merge 1 commit into
google:masterfrom
jannes-m:docker-snapshotter-rootfs-prefix

Conversation

@jannes-m

Copy link
Copy Markdown

What

When the Docker storage driver is the containerd snapshotter (overlayfs), newContainerHandler takes rootfsStorageDir from the containerd spec (spec.Root.Path), a host path, and uses it as is.
The other storage drivers derive it from storageDir, which is already joined with /rootfs when cAdvisor does not run in the host namespace.
This joins spec.Root.Path with rootFs the same way.

Why

cAdvisor in a container with the host's / at /rootfs (the documented setup) and a non-default Docker data root logs, for every container:

failed to collect filesystem stats - rootDiskErr: could not stat "/home/docker/rootfs/overlayfs/<id>" to get inode usage: ... no such file or directory

With the default data root it only works when /var/lib/docker is also mounted at the same path.

Testing

Docker 29 with "features": {"containerd-snapshotter": true} and "data-root": "/home/docker", cAdvisor run in a container with -v /:/rootfs:ro -v /var/run:/var/run -v /sys:/sys:ro and no data-root mount:

  • before: could not stat "/home/docker/rootfs/overlayfs/<id>" on each housekeeping
  • after: no error

go test ./container/docker/... passes.
Related to #3892, which adds ContainerdSnapshotterStorageDriver to FsStats(); this fix is needed for that path to resolve when cAdvisor runs in a container.

@google-cla

google-cla Bot commented Nov 25, 2026

Copy link
Copy Markdown

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

@jannes-m

Copy link
Copy Markdown
Author

Closing in favour of #3976, which reports the bug with the same reproduction and the suggested one-line change.

@jannes-m jannes-m closed this Nov 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant